﻿namespace HRM.CORE
{

    using APP.HELPER.Data.Helper;
    using System; using Extra.ERP;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;

    public class HRM_INSURANCE_MODIFY
    {
        private string m_ContentChange;
        private DateTime m_DecideDate;
        private string m_DecideNumber;
        private string m_DecidePerson;
        private string m_EmployeeCode;
        private string m_EmployeeName;
        private string m_HealthInsuranceCode;
        private Guid m_InsuranceTableListID;
        private Guid m_ModifyID;
        private string m_NewContent;
        private string m_OldContent;
        private string m_Reason;
        private string m_SocialInsuranceCode;

        public HRM_INSURANCE_MODIFY()
        {
            this.m_ModifyID = Guid.Empty;
            this.m_InsuranceTableListID = Guid.Empty;
            this.m_EmployeeCode = "";
            this.m_EmployeeName = "";
            this.m_SocialInsuranceCode = "";
            this.m_HealthInsuranceCode = "";
            this.m_ContentChange = "";
            this.m_OldContent = "";
            this.m_NewContent = "";
            this.m_Reason = "";
            this.m_DecideNumber = "";
            this.m_DecideDate = DateTime.Now;
            this.m_DecidePerson = "";
        }

        public HRM_INSURANCE_MODIFY(Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            this.m_ModifyID = ModifyID;
            this.m_InsuranceTableListID = InsuranceTableListID;
            this.m_EmployeeCode = EmployeeCode;
            this.m_EmployeeName = EmployeeName;
            this.m_SocialInsuranceCode = SocialInsuranceCode;
            this.m_HealthInsuranceCode = HealthInsuranceCode;
            this.m_ContentChange = ContentChange;
            this.m_OldContent = OldContent;
            this.m_NewContent = NewContent;
            this.m_Reason = Reason;
            this.m_DecideNumber = DecideNumber;
            this.m_DecideDate = DecideDate;
            this.m_DecidePerson = DecidePerson;
        }

        public string Delete()
        {
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { this.m_ModifyID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Delete", myParams, myValues);
        }

        public string Delete(Guid ModifyID)
        {
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Delete", myParams, myValues);
        }

        public string Delete(SqlConnection myConnection, Guid ModifyID)
        {
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_MODIFY_Delete", myParams, myValues);
        }

        public string Delete(SqlTransaction myTransaction, Guid ModifyID)
        {
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_MODIFY_Delete", myParams, myValues);
        }

        public bool Exist(Guid ModifyID)
        {
            bool hasRows = false;
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_INSURANCE_MODIFY_Get", myParams, myValues);
            if (reader != null)
            {
                hasRows = reader.HasRows;
                reader.Close();
                helper.Close();
                reader = null;
            }
            return hasRows;
        }

        public string Get(Guid ModifyID)
        {
            string str = "";
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader("HRM_INSURANCE_MODIFY_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ModifyID = reader.GetGuid(reader.GetOrdinal("ModifyID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_ContentChange = Convert.ToString(reader["ContentChange"]);
                    this.m_OldContent = Convert.ToString(reader["OldContent"]);
                    this.m_NewContent = Convert.ToString(reader["NewContent"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_DecideNumber = Convert.ToString(reader["DecideNumber"]);
                    this.m_DecideDate = Convert.ToDateTime(reader["DecideDate"]);
                    this.m_DecidePerson = Convert.ToString(reader["DecidePerson"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlConnection myConnection, Guid ModifyID)
        {
            string str = "";
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myConnection, "HRM_INSURANCE_MODIFY_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ModifyID = reader.GetGuid(reader.GetOrdinal("ModifyID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_ContentChange = Convert.ToString(reader["ContentChange"]);
                    this.m_OldContent = Convert.ToString(reader["OldContent"]);
                    this.m_NewContent = Convert.ToString(reader["NewContent"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_DecideNumber = Convert.ToString(reader["DecideNumber"]);
                    this.m_DecideDate = Convert.ToDateTime(reader["DecideDate"]);
                    this.m_DecidePerson = Convert.ToString(reader["DecidePerson"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public string Get(SqlTransaction myTransaction, Guid ModifyID)
        {
            string str = "";
            string[] myParams = new string[] { "@ModifyID" };
            object[] myValues = new object[] { ModifyID };
            SqlHelper helper = new SqlHelper();
            SqlDataReader reader = helper.ExecuteReader(myTransaction, "HRM_INSURANCE_MODIFY_Get", myParams, myValues);
            if (reader != null)
            {
                while (reader.Read())
                {
                    this.m_ModifyID = reader.GetGuid(reader.GetOrdinal("ModifyID"));
                    this.m_InsuranceTableListID = reader.GetGuid(reader.GetOrdinal("InsuranceTableListID"));
                    this.m_EmployeeCode = Convert.ToString(reader["EmployeeCode"]);
                    this.m_EmployeeName = Convert.ToString(reader["EmployeeName"]);
                    this.m_SocialInsuranceCode = Convert.ToString(reader["SocialInsuranceCode"]);
                    this.m_HealthInsuranceCode = Convert.ToString(reader["HealthInsuranceCode"]);
                    this.m_ContentChange = Convert.ToString(reader["ContentChange"]);
                    this.m_OldContent = Convert.ToString(reader["OldContent"]);
                    this.m_NewContent = Convert.ToString(reader["NewContent"]);
                    this.m_Reason = Convert.ToString(reader["Reason"]);
                    this.m_DecideNumber = Convert.ToString(reader["DecideNumber"]);
                    this.m_DecideDate = Convert.ToDateTime(reader["DecideDate"]);
                    this.m_DecidePerson = Convert.ToString(reader["DecidePerson"]);
                    str = "OK";
                }
                reader.Close();
                helper.Close();
                reader = null;
            }
            return str;
        }

        public DataTable GetList()
        {
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_MODIFY_GetList");
        }

        public DataTable GetList(Guid InsuranceTableListID)
        {
            string[] myParams = new string[] { "@InsuranceTableListID" };
            object[] myValues = new object[] { InsuranceTableListID };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteDataTable("HRM_INSURANCE_MODIFY_GetListByInsuranceTableList", myParams, myValues);
        }

        public string Insert()
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { this.m_ModifyID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_ContentChange, this.m_OldContent, this.m_NewContent, this.m_Reason, this.m_DecideNumber, this.m_DecideDate, this.m_DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { this.m_ModifyID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_ContentChange, this.m_OldContent, this.m_NewContent, this.m_Reason, this.m_DecideNumber, this.m_DecideDate, this.m_DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_MODIFY_Insert", myParams, myValues);
        }

        public string Insert(Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Insert", myParams, myValues);
        }

        public string Insert(SqlConnection myConnection, Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_MODIFY_Insert", myParams, myValues);
        }

        public string Insert(SqlTransaction myTransaction, Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_MODIFY_Insert", myParams, myValues);
        }

        public string NewID()
        {
            return SqlHelper.GenCode("HRM_INSURANCE_MODIFY", "InsuranceTableListID", "CV");
        }

        public string Update()
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { this.m_ModifyID, this.m_InsuranceTableListID, this.m_EmployeeCode, this.m_EmployeeName, this.m_SocialInsuranceCode, this.m_HealthInsuranceCode, this.m_ContentChange, this.m_OldContent, this.m_NewContent, this.m_Reason, this.m_DecideNumber, this.m_DecideDate, this.m_DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Update", myParams, myValues);
        }

        public string Update(Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery("HRM_INSURANCE_MODIFY_Update", myParams, myValues);
        }

        public string Update(SqlConnection myConnection, Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myConnection, "HRM_INSURANCE_MODIFY_Update", myParams, myValues);
        }

        public string Update(SqlTransaction myTransaction, Guid ModifyID, Guid InsuranceTableListID, string EmployeeCode, string EmployeeName, string SocialInsuranceCode, string HealthInsuranceCode, string ContentChange, string OldContent, string NewContent, string Reason, string DecideNumber, DateTime DecideDate, string DecidePerson)
        {
            string[] myParams = new string[] { "@ModifyID", "@InsuranceTableListID", "@EmployeeCode", "@EmployeeName", "@SocialInsuranceCode", "@HealthInsuranceCode", "@ContentChange", "@OldContent", "@NewContent", "@Reason", "@DecideNumber", "@DecideDate", "@DecidePerson" };
            object[] myValues = new object[] { ModifyID, InsuranceTableListID, EmployeeCode, EmployeeName, SocialInsuranceCode, HealthInsuranceCode, ContentChange, OldContent, NewContent, Reason, DecideNumber, DecideDate, DecidePerson };
            SqlHelper helper = new SqlHelper();
            return helper.ExecuteNonQuery(myTransaction, "HRM_INSURANCE_MODIFY_Update", myParams, myValues);
        }

        [Category("Column"), DisplayName("ContentChange")]
        public string ContentChange
        {
            get
            {
                return this.m_ContentChange;
            }
            set
            {
                this.m_ContentChange = value;
            }
        }

        [Category("Column"), DisplayName("DecideDate")]
        public DateTime DecideDate
        {
            get
            {
                return this.m_DecideDate;
            }
            set
            {
                this.m_DecideDate = value;
            }
        }

        [Category("Column"), DisplayName("DecideNumber")]
        public string DecideNumber
        {
            get
            {
                return this.m_DecideNumber;
            }
            set
            {
                this.m_DecideNumber = value;
            }
        }

        [Category("Column"), DisplayName("DecidePerson")]
        public string DecidePerson
        {
            get
            {
                return this.m_DecidePerson;
            }
            set
            {
                this.m_DecidePerson = value;
            }
        }

        [DisplayName("EmployeeCode"), Category("Column")]
        public string EmployeeCode
        {
            get
            {
                return this.m_EmployeeCode;
            }
            set
            {
                this.m_EmployeeCode = value;
            }
        }

        [DisplayName("EmployeeName"), Category("Column")]
        public string EmployeeName
        {
            get
            {
                return this.m_EmployeeName;
            }
            set
            {
                this.m_EmployeeName = value;
            }
        }

        [DisplayName("HealthInsuranceCode"), Category("Column")]
        public string HealthInsuranceCode
        {
            get
            {
                return this.m_HealthInsuranceCode;
            }
            set
            {
                this.m_HealthInsuranceCode = value;
            }
        }

        [Category("Column"), DisplayName("InsuranceTableListID")]
        public Guid InsuranceTableListID
        {
            get
            {
                return this.m_InsuranceTableListID;
            }
            set
            {
                this.m_InsuranceTableListID = value;
            }
        }

        [DisplayName("ModifyID"), Category("Primary Key")]
        public Guid ModifyID
        {
            get
            {
                return this.m_ModifyID;
            }
            set
            {
                this.m_ModifyID = value;
            }
        }

        [DisplayName("NewContent"), Category("Column")]
        public string NewContent
        {
            get
            {
                return this.m_NewContent;
            }
            set
            {
                this.m_NewContent = value;
            }
        }

        [DisplayName("OldContent"), Category("Column")]
        public string OldContent
        {
            get
            {
                return this.m_OldContent;
            }
            set
            {
                this.m_OldContent = value;
            }
        }

        public string ProductName
        {
            get
            {
                return "Class HRM_INSURANCE_MODIFY";
            }
        }

        public string ProductVersion
        {
            get
            {
                return "1.0.0.0";
            }
        }

        [Category("Column"), DisplayName("Reason")]
        public string Reason
        {
            get
            {
                return this.m_Reason;
            }
            set
            {
                this.m_Reason = value;
            }
        }

        [Category("Column"), DisplayName("SocialInsuranceCode")]
        public string SocialInsuranceCode
        {
            get
            {
                return this.m_SocialInsuranceCode;
            }
            set
            {
                this.m_SocialInsuranceCode = value;
            }
        }
    }
}

